package com.yashi.springmvcjbpm.ruleTest;

import org.jbpm.api.jpdl.DecisionHandler;
import org.jbpm.api.model.OpenExecution;

import com.yashi.springmvcjbpm.dao.impl.StaffDAOImpl;
import com.yashi.springmvcjbpm.service.impl.RuleServiceimpl;

public class ApplyDecision implements DecisionHandler {
	private StaffDAOImpl staffDaoImpl = new StaffDAOImpl();
	@Override
	public String decide(OpenExecution arg0) {
		System.out.println("map==================="+arg0.getVariables());
		String staffName = (String)arg0.getVariable("staff");
		String staffPosition = staffDaoImpl.getStaffPosition(staffName);
		System.out.println("staffPosition===="+staffPosition);
		String outcome = null;
		if(staffPosition.equals("staff")) {
			outcome = "员工请假经理审批";
		}else if(staffPosition.equals("manager")) {
			outcome = "经理请假老板审批";
		}
		return outcome;
	}

}
